class Solution
{
public:
    vector<bool> kidsWithCandies(vector<int> &candies, int extraCandies)
    {
        int n = candies.size();
        vector<bool> result(n);
        int maxCandy = *max_element(candies.begin(), candies.end());
        int threshold = maxCandy - extraCandies;
        for (int i = 0; i < n; ++i)
        {
            result[i] = candies[i] >= threshold;
        }
        return result;
    }
};